url = 'https://www.acwing.com/problem/content/3580/'

n = int(input())
n_data = list(map(int, input().split()))

m = int(input())
m_data = list(map(int, input().split()))

for i in n_data:
    for j in m_data:
        if i + j not in n_data and i + j not in m_data:
            print(i, j)
            exit(0)
